package com.cq.hd.member.api;

import com.alibaba.fastjson.JSONObject;
import com.cq.hd.common.pagination.Page;
import com.cq.hd.common.response.Result;
import com.cq.hd.member.api.dto.*;
import com.cq.hd.member.api.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "hd-o2o-member-service", contextId = "member-card-api")
public interface TbMemberCardApi {

    // 添加
    @PostMapping("/member/memberCard/saveMemberCard")
    Result<Long> saveMemberCard(@RequestBody MemberCardSaveDto memberCardSaveDto);

    // 编辑
    @PutMapping("/member/memberCard/updateMemberCard")
    Result<Boolean> updateMemberCard(@RequestBody MemberCardUpdateDto memberCardUpdateDto);

    // 列表
    @GetMapping("/member/memberCard/pageMemberCard")
    Result<Page<MemberCardPageVo>> pageMemberCard(@SpringQueryMap MemberCardPageDto memberCardPageDto);

    // 商家端分页列表
    @GetMapping("/member/memberCard/pageAppMemberCard")
    Result<Page<AppMemberCardPageVo>> pageAppMemberCard(@SpringQueryMap AppMemberCardPageDto appMemberCardPageDto);

    // 创建充值订单，返回充值订单号
    @PostMapping("/member/memberCard/createAppMemberCardOrder")
    Result<String> createAppMemberCardOrder(@RequestBody AppMemberCardCreateDto appMemberCardCreateDto);

    // 立即支付，唤起第三方支付
    @PostMapping("/member/memberCard/payAppMemberCardOrder")
    Result<AppMemberCardPayVo> payAppMemberCardOrder(@RequestBody AppMemberCardPayDto appMemberCardPayDto);

    // 聚合正扫下单回调
    @PostMapping("/member/memberCard/jsPayCallback")
    Result<Boolean> jsPayCallback(@RequestBody JSONObject dataObj);

    // 查单（只要唤醒了第三方支付，关闭第三方支付页面之后，不管是成功还是失败，都要调用）
    @PostMapping("/member/memberCard/queryOrderPay")
    Result<Boolean> queryOrderPay(@RequestBody AppMemberCardPayQueryDto appMemberCardPayQueryDto);

    // 获取次卡详情
    @PostMapping("/member/memberCard/detailById")
    Result<MemberCardPageVo> detailById(@RequestParam("id") Long id);

    // 网银支付购买次卡
    @PostMapping("/member/memberCard/bankPayAppMemberCardOrder")
    Result<BankPayRechargeVo> bankPayAppMemberCardOrder(@RequestBody AdminBusinessMemberCardPayDto adminBusinessMemberCardPayDto);

    // 网银支付查单
    @PostMapping("/member/memberCard/queryBankPayOrder")
    Result<BankPayQueryVo> queryBankPayOrder(@RequestBody BankPayQueryDto bankPayQueryDto);

    // 网银购买次卡回调
    @PostMapping("/member/memberCard/bankPayCallback")
    Result<Boolean> bankPayCallback(@RequestBody JSONObject dataObj);
}
